#pragma once

#include "TextReader.h"

#include "Animation.h"
#include "StoredAnimationNode.h"
#include "DAEFloat4.h"
#include "util.h"

#include "rapidxml.hpp"
using namespace rapidxml;

class AnimationReader:public TextReader
{
public:
	/**
	* Creates a new AnimationReader with the provided file
	*/
	AnimationReader(tstring m_File);
	/**
	* Destroys the AnimationReader object
	*/
	virtual ~AnimationReader(void);
	/**
	* Reads the file and returns true if reading the file
	* was succesful.
	*/
	bool Read();
	/**
	* Returns the animation object that was read.
	* @return the Animation object
	*/
	Animation* GetAnimation() const
	{
		return m_pAnimation;
	}
protected:
	/**
	* Parse an animation element.
	* @param anim the pointer to the animation element.
	*/ 
	void ParseAnim(xml_node<tchar> *anim);
	/**
	* Parse a time transform element.
	* @param anim the pointer to the time transform element.
	*/
	void ParseTimeTransform(xml_node<tchar> *transform);
private:
	/**
	* The resulting animation object.
	*/
	Animation* m_pAnimation;
	/**
	* The current animation node.
	*/
	StoredAnimationNode* m_pStoredAnimationNode;
	/**
	* The current time
	*/
	unsigned int m_CurrentTime;
	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------

	AnimationReader(const AnimationReader& t);
	AnimationReader& operator=(const AnimationReader& t);
};
